<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
</head>

<body>
  <button id="btnGET">GET</button>
  <button id="btnPOST">POST</button>

  <script>
    $(function () {
      //1.测试GET接口
      $('#btnGET').on('click', function () {
        $.ajax({
          url: 'http://localhost:3000/users',
          type: 'GET',
          data: { name: 'zs', age: 20 },
          success: function (res) {
            console.log(res)
          },
        })
      });
      //2.测试POST接口
      $('#btnPOST').on('click', function () {
        $.ajax({
          url: 'http://localhost:3000/users',
          type: 'POST',
          data: { name: 'ls', age: 30 },
          success: function (res) {
            console.log(res)
          },
        })

      });



    })

  </script>

</body>

</html>